<template>
  <div class="mod-config">
    <table-view ref="view"
                :searchAttrs="searchAttrs"
                :primaryKey="primaryKey"
                :listApiName="listApiName"
                :deleteApiName="deleteApiName"
                :saveAuthName="saveAuthName"
                :deleteAuthName="deleteAuthName"
                :showAttrs="showAttrs"
    >
    </table-view>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  </div>
</template>

<script>
import tableView from '@/components/tableView'
import basicMixins from '@/utils/commonViewMixins'
import AddOrUpdate from './boxfactory-add-or-update'

export default {
  mixins: [basicMixins],
  data() {
    return {
      searchAttrs: {
        factoryName:{
          label: '纸箱厂名称',
          placeholder: '请输入纸箱厂名称'
        }
      },
      primaryKey: 'id',
      listApiName: 'boxApi/listBoxFactoryList',
      deleteApiName: 'boxApi/deleteBoxFactory',
      saveAuthName: 'box:boxfactory:save',
      deleteAuthName: 'box:boxfactory:delete',
      showAttrs: {
        factoryName: {
          label: '厂家名字'
        },
        principal: {
          label: '负责人'
        },
        mobilePhoneNumber: {
          label: '手机号'
        },
        telephoneNumber: {
          label: '电话'
        },
        remark: {
          label: '备注',
          inputType: 'textarea',
          placeholder: '请输入备注'
        },
        status: {
          label: '状态',
          type: 'radio',
          items: [
            {value: 0, text: '禁用', tagType: 'danger'},
            {value: 1, text: '正常'}
          ]
        }
      }
    }
  },
  components: {
    AddOrUpdate,
    tableView
  }
}
</script>
